Round
The Round command rounds or truncates a number to an integer. It is one of two commands provided by the Numerics scripting addition.By default, Round rounds to the nearest number. You may also include an optional parameter to specify rounding up, down, toward zero, or to the nearest number.
SYNTAX
round number ¬ [ rounding ( up | down | toward zero | to nearest ) ]PARAMETER
See the examples that follow for demonstrations of the possible values of the
- number
- The number to round.
Class: Numberrounding
parameter.RESULT
The result is an integer: the rounded value.EXAMPLES
display dialog "round -3.67: " & (round -3.67) & return & ¬ "round 3.67: " & (round 3.67) display dialog "round -3.67 up: " & ¬ (round -3.67 rounding up) & return & ¬ "round 3.67 up: " & (round 3.67 rounding up) display dialog "round -3.67 down: " & ¬ (round -3.67 rounding down) & return & ¬ "round 3.67 down: " & (round 3.6 rounding down) display dialog "round -3.67 toward zero: " & ¬ (round -3.67 rounding toward zero) & return & ¬ "round 3.67 toward zero: " & ¬ (round 3.67 rounding toward zero) display dialog "round -3.67 to nearest: " & ¬ (round -3.67 rounding to nearest) & return & ¬ "round 3.67 to nearest: " & ¬ (round 3.67 rounding to nearest)ERRORS